<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: cube.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_12cda917fe1d7c8b4e7d2501bb3636e4.html">sdk</a></li><li class="navelem"><a class="el" href="dir_2f23e30b638d6a5f333babd9a5d183e1.html">include</a></li><li class="navelem"><a class="el" href="dir_d5ace589187da7c83c1a7507ec9fbbef.html">sifteo</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">cube.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * This file is part of the public interface to the Sifteo SDK.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright &lt;c&gt; 2012 Sifteo, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifdef NOT_USERSPACE</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#   error This is a userspace-only header, not allowed by the current build.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;sifteo/limits.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;sifteo/macros.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;sifteo/math.h&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;sifteo/array.h&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keyword">namespace </span>Sifteo {</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3">   35</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> {</div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3aa7e252d70c0048985f2a0e5be572dfb0">   36</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3aa7e252d70c0048985f2a0e5be572dfb0" title="Top side (Y-)">TOP</a> = 0,            </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a0cdc44fae1a8ecdb1155e0cc55db46a9">   37</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a0cdc44fae1a8ecdb1155e0cc55db46a9" title="Left side (X-)">LEFT</a>,               </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3adbddf65002d96370660e58b1141516b8">   38</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3adbddf65002d96370660e58b1141516b8" title="Bottom side (Y+)">BOTTOM</a>,             </div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a059aa70ec021f7afb1510be19083172d">   39</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a059aa70ec021f7afb1510be19083172d" title="Right side (X+)">RIGHT</a>,              </div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3acfd3767ac3e69432b6a0bd7106c35f4e">   40</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3acfd3767ac3e69432b6a0bd7106c35f4e" title="Total number of sides (4)">NUM_SIDES</a>,          </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a907c90c21486c90c851379c9dd79b1b8">   41</a></span>&#160;    <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a907c90c21486c90c851379c9dd79b1b8" title="Nil value (-1)">NO_SIDE</a> = -1        </div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;};</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="code" href="group__cube.html#ga8052369e39d6f58cb7d395024dfa21ee">   51</a></span>&#160;<span class="keyword">typedef</span> _SYSCubeID <a class="code" href="group__cube.html#ga8052369e39d6f58cb7d395024dfa21ee" title="Alternate POD type for CubeID storage.">PCubeID</a>;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html">   66</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> {</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    _SYSCubeID sys;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2">   70</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> _SYSCubeID <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a> = _SYS_NUM_CUBE_SLOTS;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#ac9ab1ce1985b9cc8adf58912ce805fce">   73</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> _SYSCubeID <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ac9ab1ce1985b9cc8adf58912ce805fce" title="A reserved ID, used to mark undefined CubeIDs.">UNDEFINED</a> = _SYS_CUBE_ID_INVALID;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#aab0888b549def067f5c99dbf67bd022b">   80</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aab0888b549def067f5c99dbf67bd022b" title="Default constructor. By default, a CubeID is initialized to a special Undefined value. This value can be tested for with the isDefined() predicate.">CubeID</a>() : sys(<a class="code" href="struct_sifteo_1_1_cube_i_d.html#ac9ab1ce1985b9cc8adf58912ce805fce" title="A reserved ID, used to mark undefined CubeIDs.">UNDEFINED</a>) {}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a181cf2e6fc5f5f1092aca53c8b57b40a">   86</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a181cf2e6fc5f5f1092aca53c8b57b40a" title="Initialize a CubeID with a concrete slot value. Slots are numbered from 0 to NUM_SLOTS - 1...">CubeID</a>(_SYSCubeID sys) : sys(sys) {}</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#ae46d5f88211b0bb10ad80b8d5e4d6c4a">   91</a></span>&#160;    <span class="keyword">operator</span> _SYSCubeID()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keywordflow">return</span> sys;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#aa55dd1fee4831ef88ef9bdb9f7204556">  102</a></span>&#160;    _SYSCubeIDVector <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aa55dd1fee4831ef88ef9bdb9f7204556" title="Return the _SYSCubeIDVector bit associated with this ID.">bit</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <span class="keywordflow">return</span> 0x80000000 &gt;&gt; sys;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    }</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    </div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a0e5978f34c8410f40dba24f96f0908fb">  110</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a0e5978f34c8410f40dba24f96f0908fb" title="Is this a CubeID that was initialized with a valid slot number, and not one that was initialized as u...">isDefined</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        <span class="keywordflow">return</span> sys != <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ac9ab1ce1985b9cc8adf58912ce805fce" title="A reserved ID, used to mark undefined CubeIDs.">UNDEFINED</a>;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a6da5d2ed7096f343f921b2a879c54e80">  125</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a6da5d2ed7096f343f921b2a879c54e80" title="Return the physical accelerometer state, as a signed byte-vector.">accel</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        _SYSByte4 v;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        v.value = _SYS_getAccel(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(v.x, v.y, v.z);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#aa88b3ce31e942420975a8c94b6dd6ef7">  136</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aa88b3ce31e942420975a8c94b6dd6ef7" title="Is this cube being touched right now? Return the current state of the touch sensor.">isTouching</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        <span class="keywordflow">return</span> _SYS_isTouching(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    }</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    </div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a549ddda56ae229b39cf5e980d4e0fae8">  149</a></span>&#160;    uint64_t <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a549ddda56ae229b39cf5e980d4e0fae8" title="Return the cube&#39;s unique 64-bit hardware ID. This ID uniquely identifies the cube that this slot is p...">hwID</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <span class="keywordflow">return</span> _SYS_getCubeHWID(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    }</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div>
<div class="line"><a name="l00162"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a69ef118d050558bb080467b95f0fc865">  162</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a69ef118d050558bb080467b95f0fc865" title="Detach any video buffer which was previously attached to this cube.">detachVideoBuffer</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        _SYS_finish();</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        _SYS_setVideoBuffer(*<span class="keyword">this</span>, 0);</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    }</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#afe9084daa9d9609cae70bed558e1f3cd">  175</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#afe9084daa9d9609cae70bed558e1f3cd" title="Detach any motion buffer which was previously attached to this cube.">detachMotionBuffer</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        _SYS_setMotionBuffer(*<span class="keyword">this</span>, 0);</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    }</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#adf7619787645fad6e523d8f3e5bb8e59">  194</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#adf7619787645fad6e523d8f3e5bb8e59" title="Get this cube&#39;s battery level.">batteryLevel</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;        <span class="keywordflow">return</span> _SYS_cubeBatteryLevel(*<span class="keyword">this</span>) / float(_SYS_BATTERY_MAX);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    }</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;</div>
<div class="line"><a name="l00204"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_cube_i_d.html#a327a4939945b52a6756ab9f2b801ba86">  204</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_cube_i_d.html#a327a4939945b52a6756ab9f2b801ba86" title="Remove the persistent pairing association between this cube and the current Base.">unpair</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(sys &lt; <a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        _SYS_unpair(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    }</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> operator ++() { <span class="keywordflow">return</span> ++sys; }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aab0888b549def067f5c99dbf67bd022b" title="Default constructor. By default, a CubeID is initialized to a special Undefined value. This value can be tested for with the isDefined() predicate.">CubeID</a> operator ++(<span class="keywordtype">int</span>) { <span class="keywordflow">return</span> sys++; }</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aab0888b549def067f5c99dbf67bd022b" title="Default constructor. By default, a CubeID is initialized to a special Undefined value. This value can be tested for with the isDefined() predicate.">CubeID</a> operator --() { <span class="keywordflow">return</span> --sys; }</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html#aab0888b549def067f5c99dbf67bd022b" title="Default constructor. By default, a CubeID is initialized to a special Undefined value. This value can be tested for with the isDefined() predicate.">CubeID</a> operator --(<span class="keywordtype">int</span>) { <span class="keywordflow">return</span> sys--; }</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;};</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;</div>
<div class="line"><a name="l00223"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html">  223</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> : <span class="keyword">public</span> <a class="code" href="class_sifteo_1_1_bit_array.html" title="A fixed-size array of bits, with compact storage and fast iteration.">BitArray</a>&lt;_SYS_NUM_CUBE_SLOTS&gt; {</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00226"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#ae2cee5d9cbb575508ddb4d7c23538588">  226</a></span>&#160;    <span class="keyword">operator</span> _SYSCubeIDVector()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        <span class="keywordflow">return</span> words[0];</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    }</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div>
<div class="line"><a name="l00231"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#aa5376186b662e2e889e20b89821c1c55">  231</a></span>&#160;    <a class="code" href="class_sifteo_1_1_cube_set.html#aa5376186b662e2e889e20b89821c1c55" title="Implicit conversion from a BitArray of the correct size.">CubeSet</a>(<span class="keyword">const</span> <a class="code" href="class_sifteo_1_1_bit_array.html">BitArray&lt;_SYS_NUM_CUBE_SLOTS&gt;</a> &amp;bits) : <a class="code" href="class_sifteo_1_1_bit_array.html" title="A fixed-size array of bits, with compact storage and fast iteration.">BitArray</a>&lt;_SYS_NUM_CUBE_SLOTS&gt;(bits) {}</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div>
<div class="line"><a name="l00234"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#a597e66433c3ea216a22e9c31891a2b45">  234</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_sifteo_1_1_cube_set.html#a597e66433c3ea216a22e9c31891a2b45" title="Create an empty CubeSet.">CubeSet</a>() : <a class="code" href="class_sifteo_1_1_bit_array.html" title="A fixed-size array of bits, with compact storage and fast iteration.">BitArray</a>&lt;_SYS_NUM_CUBE_SLOTS&gt;() {}</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#a95128b6a0bf02d22db56269b6fad109e">  237</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_sifteo_1_1_cube_set.html#a95128b6a0bf02d22db56269b6fad109e" title="Create a CubeSet with a single CubeID in it.">CubeSet</a>(<a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> cube) : <a class="code" href="class_sifteo_1_1_bit_array.html" title="A fixed-size array of bits, with compact storage and fast iteration.">BitArray</a>&lt;_SYS_NUM_CUBE_SLOTS&gt;(cube) {}</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;</div>
<div class="line"><a name="l00244"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#afb3aef1789fafe8b6fe9bce6af6606ae">  244</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_sifteo_1_1_cube_set.html#afb3aef1789fafe8b6fe9bce6af6606ae" title="Create a new CubeSet with a range of cubes.">CubeSet</a>(<a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> <a class="code" href="class_sifteo_1_1_bit_array.html#abaf8764c94ae4f4fc241db2146a45802" title="Return an STL-style iterator for this array.">begin</a>, <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> <a class="code" href="class_sifteo_1_1_bit_array.html#a261a2f960102911cd5164e8479dd2e95" title="Return an STL-style iterator for this array.">end</a>) : <a class="code" href="class_sifteo_1_1_bit_array.html" title="A fixed-size array of bits, with compact storage and fast iteration.">BitArray</a>&lt;_SYS_NUM_CUBE_SLOTS&gt;(begin, end) {}</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;</div>
<div class="line"><a name="l00251"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#ad2aa667b04704accb887d5895fb8a505">  251</a></span>&#160;     uint32_t <a class="code" href="class_sifteo_1_1_cube_set.html#ad2aa667b04704accb887d5895fb8a505" title="Getter for the underlying bitmask.">mask</a>()<span class="keyword"> const </span>{ </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;         <span class="keywordflow">return</span> words[0]; </div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;     }</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;     </div>
<div class="line"><a name="l00261"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#adfa05385f3f82b9529bc5cb9897581f1">  261</a></span>&#160;      <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_cube_set.html#adfa05385f3f82b9529bc5cb9897581f1" title="Setter for the underlying bitmask.">setMask</a>(uint32_t <a class="code" href="class_sifteo_1_1_cube_set.html#ad2aa667b04704accb887d5895fb8a505" title="Getter for the underlying bitmask.">mask</a>) {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;          <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>( (mask &amp; ((1&lt;&lt;(32-<a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>))-1)) == 0 );</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;          words[0] = <a class="code" href="class_sifteo_1_1_cube_set.html#ad2aa667b04704accb887d5895fb8a505" title="Getter for the underlying bitmask.">mask</a>;</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;      }</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;</div>
<div class="line"><a name="l00279"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_cube_set.html#ae4e5e450846b0a6c655705249b6112be">  279</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> <a class="code" href="class_sifteo_1_1_cube_set.html#ae4e5e450846b0a6c655705249b6112be" title="Return a CubeSet containing all connected cubes which are visible to the current application.">connected</a>() {</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;        <a class="code" href="class_sifteo_1_1_cube_set.html" title="An unordered set of cubes.">CubeSet</a> result;</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;        result.words[0] = _SYS_getConnectedCubes();</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    }</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;};</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;</div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html">  295</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html" title="A lightweight identifier for one neighbored object.">NeighborID</a> {</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    _SYSNeighborID sys;</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;</div>
<div class="line"><a name="l00301"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#af65b996f735c92522490ebdc1ea4f226">  301</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#af65b996f735c92522490ebdc1ea4f226" title="Default constructor. Initializes an empty NeighborID.">NeighborID</a>() : sys(_SYS_NEIGHBOR_NONE) {}</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;</div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#ab230cf267c308ff9c3c7dabc9b3fb216">  306</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#ab230cf267c308ff9c3c7dabc9b3fb216" title="Initialize a NeighborID with a concrete value.">NeighborID</a>(_SYSNeighborID sys) : sys(sys) {}</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;</div>
<div class="line"><a name="l00311"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#af66f9cddf3c0318da3d72a403c3b7aaf">  311</a></span>&#160;    <span class="keyword">operator</span> _SYSNeighborID()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;        <span class="keywordflow">return</span> sys;</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;    }</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;</div>
<div class="line"><a name="l00316"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#a7da829121dc956ea2622fcc290d45d5b">  316</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#a7da829121dc956ea2622fcc290d45d5b" title="Is this neighbor a cube?">isCube</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;        <span class="keywordflow">return</span> sys &lt; _SYS_NUM_CUBE_SLOTS;</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    }</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;</div>
<div class="line"><a name="l00321"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#acca04dc07685b3daf3b991bb62deb2fb">  321</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#acca04dc07685b3daf3b991bb62deb2fb" title="Is this neighbor a base?">isBase</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;        <span class="keywordflow">return</span> (sys &amp; _SYS_NEIGHBOR_TYPE_MASK) == _SYS_NEIGHBOR_BASE;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    }</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;</div>
<div class="line"><a name="l00326"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#ab5d27d9ca3415881e82a7701d5725a5e">  326</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#ab5d27d9ca3415881e82a7701d5725a5e" title="Is there nothing neighbored at all?">isEmpty</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;        <span class="keywordflow">return</span> sys == _SYS_NEIGHBOR_NONE;</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    }</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;</div>
<div class="line"><a name="l00335"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#aa6f151c5420f613058ec3bb1b05585b9">  335</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#aa6f151c5420f613058ec3bb1b05585b9" title="Convert this NeighborID to a CubeID.">cube</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#a7da829121dc956ea2622fcc290d45d5b" title="Is this neighbor a cube?">isCube</a>() ? <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a>(sys) : <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a>();</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    }</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;};</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div>
<div class="line"><a name="l00349"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html">  349</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_neighborhood.html" title="A Neighborhood is a description of all neighbors for a single cube, packed into a small value...">Neighborhood</a> {</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    _SYSNeighborState sys;</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;</div>
<div class="line"><a name="l00355"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#a8cb7e9d4601e64e772dcf64f872af23c">  355</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighborhood.html#a8cb7e9d4601e64e772dcf64f872af23c" title="Default constructor. Leaves the Neighborhood uninitialized.">Neighborhood</a>() {}</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    </div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#a8ba78cc8f81130a5f5b3036ce545fc23">  360</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighborhood.html#a8ba78cc8f81130a5f5b3036ce545fc23" title="Initialize a Neighborhood from a low-level _SYSNeighborState object.">Neighborhood</a>(_SYSNeighborState sys) : sys(sys) {}</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;</div>
<div class="line"><a name="l00366"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#ac72ecd67c66c0f13ede57eda4541740f">  366</a></span>&#160;    <span class="keyword">operator</span> _SYSNeighborState&amp; () {</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;        <span class="keywordflow">return</span> sys;</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;    }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;</div>
<div class="line"><a name="l00377"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#a73c6192b0a35fe17cfdb0d0a65f87209">  377</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighborhood.html#a73c6192b0a35fe17cfdb0d0a65f87209" title="Get a Neighborhood representing the physical neighbors for a cube.">Neighborhood</a>(<a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> cube) {</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(cube &lt; cube.<a class="code" href="struct_sifteo_1_1_cube_i_d.html#ab51906ee1440e3a3605ab6e2a6464bb2" title="The maximum number of distinct CubeIDs.">NUM_SLOTS</a>);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;        sys.value = _SYS_getNeighbors(cube);</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#ab6ae604fc8e088e04fc87510ea345328">  385</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_neighbor_i_d.html" title="A lightweight identifier for one neighbored object.">NeighborID</a> <a class="code" href="struct_sifteo_1_1_neighborhood.html#ab6ae604fc8e088e04fc87510ea345328" title="Return the neighbor at a particular side, as a NeighborID.">neighborAt</a>(<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(side &gt;= 0 &amp;&amp; side &lt; <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3acfd3767ac3e69432b6a0bd7106c35f4e" title="Total number of sides (4)">NUM_SIDES</a>);</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;        <span class="keywordflow">return</span> sys.sides[side];</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;    }</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;</div>
<div class="line"><a name="l00396"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#a3e57939172e343be2a3bda86d6705ccd">  396</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> <a class="code" href="struct_sifteo_1_1_neighborhood.html#a3e57939172e343be2a3bda86d6705ccd" title="Return the neighbor at a particular side, as a CubeID.">cubeAt</a>(<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_neighborhood.html#ab6ae604fc8e088e04fc87510ea345328" title="Return the neighbor at a particular side, as a NeighborID.">neighborAt</a>(side).<a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#aa6f151c5420f613058ec3bb1b05585b9" title="Convert this NeighborID to a CubeID.">cube</a>();</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;    }</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;</div>
<div class="line"><a name="l00404"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#a2bc8c2945509bce052305ef15b32d514">  404</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_neighborhood.html#a2bc8c2945509bce052305ef15b32d514" title="Is there a neighbor at this side? This is equivalent to calling !isEmpty() on the result of neighborA...">hasNeighborAt</a>(<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;        <span class="keywordflow">return</span> !<a class="code" href="struct_sifteo_1_1_neighborhood.html#ab6ae604fc8e088e04fc87510ea345328" title="Return the neighbor at a particular side, as a NeighborID.">neighborAt</a>(side).<a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#ab5d27d9ca3415881e82a7701d5725a5e" title="Is there nothing neighbored at all?">isEmpty</a>();</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    }</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;</div>
<div class="line"><a name="l00412"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#aec5a35bf730b526d88c37b79dab27719">  412</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_neighborhood.html#aec5a35bf730b526d88c37b79dab27719" title="Is there a cube at this side? This is equivalent to calling isCube() on the result of neighborAt()...">hasCubeAt</a>(<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_neighborhood.html#ab6ae604fc8e088e04fc87510ea345328" title="Return the neighbor at a particular side, as a NeighborID.">neighborAt</a>(side).<a class="code" href="struct_sifteo_1_1_neighbor_i_d.html#a7da829121dc956ea2622fcc290d45d5b" title="Is this neighbor a cube?">isCube</a>();</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;    }</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;</div>
<div class="line"><a name="l00423"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_neighborhood.html#ae2ca173acc8f80b33c17aa077493297d">  423</a></span>&#160;    <a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> <a class="code" href="struct_sifteo_1_1_neighborhood.html#ae2ca173acc8f80b33c17aa077493297d" title="Search for a CubeID in this Neighborhood.">sideOf</a>(<a class="code" href="struct_sifteo_1_1_cube_i_d.html" title="A lightweight identifier for one Sifteo cube.">CubeID</a> cube)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;        <span class="keywordflow">for</span> (<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> side = (<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a>)0; side &lt; <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3acfd3767ac3e69432b6a0bd7106c35f4e" title="Total number of sides (4)">NUM_SIDES</a>; ++side)</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;            <span class="keywordflow">if</span> (sys.sides[side] == cube)</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;                <span class="keywordflow">return</span> side;</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__cube.html#gga8dc17340f515227e9bb34532bfc2fef3a907c90c21486c90c851379c9dd79b1b8" title="Nil value (-1)">NO_SIDE</a>;</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;    }</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;};</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;};  <span class="comment">// namespace Sifteo</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
